<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of set_object</title>
  <meta name="keywords" content="set_object">
  <meta name="description" content="Replaces an entire object, i.e. a cell from one of the main 4 cell arrays">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html . -->
<h1>set_object
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Replaces an entire object, i.e. a cell from one of the main 4 cell arrays</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [subj] = set_object(subj,objtype,objname,obj) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Replaces an entire object, i.e. a cell from one of the main 4 cell arrays

 [SUBJ] = SET_OBJECT(SUBJ,OBJTYPE,OBJNAME,OBJ)

 For internal use. Use set_mat, set_objfield and set_objsubfield</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="get_number.html" class="code" title="function [objno] = get_number(subj,objtype,objname,varargin)">get_number</a>	Internal function - find the cell index of an object</li><li><a href="get_type.html" class="code" title="function [objcell] = get_type(subj,objtype)">get_type</a>	For internal use. Returns the entire cell array of a given type</li><li><a href="set_type.html" class="code" title="function [subj] = set_type(subj,objtype,objcell)">set_type</a>	Replace the entire cell array of this objtype with a new one</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="add_history.html" class="code" title="function [subj] = add_history(subj,objtype,objname,hist_str,displayme)">add_history</a>	Adds HIST_STR to OBJNAME's history field.</li><li><a href="remove_objfield.html" class="code" title="function [subj] = remove_objfield(subj,objtype,objname,fieldname)">remove_objfield</a>	Removes a field from the object</li><li><a href="set_objfield.html" class="code" title="function [subj] = set_objfield(subj,objtype,objname,fieldname,newval,varargin)">set_objfield</a>	Replace or add a field to an object</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [subj] = set_object(subj,objtype,objname,obj)</a>
0002 
0003 <span class="comment">% Replaces an entire object, i.e. a cell from one of the main 4 cell arrays</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% [SUBJ] = SET_OBJECT(SUBJ,OBJTYPE,OBJNAME,OBJ)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% For internal use. Use set_mat, set_objfield and set_objsubfield</span>
0008 
0009 <span class="comment">% This is part of the Princeton MVPA toolbox, released under the</span>
0010 <span class="comment">% GPL. See http://www.csbmb.princeton.edu/mvpa for more</span>
0011 <span class="comment">% information.</span>
0012 
0013 
0014 <span class="keyword">if</span> nargin~=4
0015   error(<span class="string">'I think you''ve forgotten to feed in all your arguments'</span>);
0016 <span class="keyword">end</span>
0017 
0018 <span class="keyword">if</span> ~nargout
0019   error(<span class="string">'Don''t forget to catch the subj structure that gets returned'</span>);
0020 <span class="keyword">end</span>
0021 
0022 <span class="keyword">if</span> ~isstruct(obj)
0023   error( sprintf(<span class="string">'You''re about to overwrite the %s %s with a non-struct'</span>, <span class="keyword">...</span>
0024    objname,objtype) );
0025 <span class="keyword">end</span>
0026   
0027 <span class="comment">% Get the entire cell array. Mess with the appropriate cell in</span>
0028 <span class="comment">% it. Replace the whole cell array</span>
0029 objcell = <a href="get_type.html" class="code" title="function [objcell] = get_type(subj,objtype)">get_type</a>(subj,objtype);
0030 objno = <a href="get_number.html" class="code" title="function [objno] = get_number(subj,objtype,objname,varargin)">get_number</a>(subj,objtype,objname);
0031 objcell{objno} = obj;
0032 subj = <a href="set_type.html" class="code" title="function [subj] = set_type(subj,objtype,objcell)">set_type</a>(subj,objtype,objcell);</pre></div>
<hr><address>Generated on Tue 06-Sep-2005 22:11:31 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>